package com.polaris.server.controller;


import com.polaris.common.utils.RespBean;
import com.polaris.server.dto.JobQueryParam;
import com.polaris.server.pojo.SysJob;
import com.polaris.server.service.ISysJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 岗位 前端控制器
 * </p>
 *
 * @author polaris
 * @since 2021-05-19
 */
@Api(tags = "职位管理")
@RestController
@RequestMapping("/api/job")
public class SysJobController {
    private final ISysJobService sysJobService;


    public SysJobController(ISysJobService sysJobService) {
        this.sysJobService = sysJobService;
    }

    @ApiOperation(value = "更新职位信息")
    @PutMapping("/update")
    public RespBean updateJob(@RequestParam Long id, @RequestBody JobQueryParam queryParam, HttpServletRequest request){
        SysJob job = sysJobService.updateJob(id, queryParam,request);
        if(job!=null){
            return RespBean.success("更新职位信息成功",job);
        }
        return RespBean.error("更新职位信息失败");
    }
}
